<?php
$page=$_GET["page"];
$limit=$_GET["limit"];
$where=$_GET["where"];

$con = mysql_connect('127.0.0.1', 'root', '');
if (!$con)
{
  die('Could not connect: ' . mysql_error());
}

mysql_select_db("webshop", $con);

$lowerLimit = $page * $limit;

$sql="SELECT producten.productnummer, producten.productnaam, producten.image, producten.cat1, producten.cat2, producten.cat3, productprijs.prijs  FROM producten,productprijs where producten.productnummer = productprijs.productnummer $where LIMIT $lowerLimit , $limit";

if (!$sql)
{
    error_log("Query $myquery failed: " . mysql_error());
    echo mysql_error();
}

$result = mysql_query($sql) or die(mysql_error());	

while($row = mysql_fetch_array($result)){
	echo $row['productnummer'];
	echo "\n";
	echo $row['productnaam'];
	echo "\n";
	echo $row['image'];
	echo "\n";
	echo $row['cat1'];
	echo "\n";
	echo $row['cat2'];
	echo "\n";
	echo $row['cat3'];
	echo "\n";
	echo $row['prijs'];
	echo "\n";
}
?> 